home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / mini.cpt / mini / CursorDialog.c < prev    next >
Text File  |  1987-09-29  |  3KB  |  98 lines

  1. /* 
  2.  * This module handles the selection of a block or underline cursor
  3.  * Author:    Jerry LeVan
  4.  *            325 Boone Trail
  5.  *            Richmond Ky 40475
  6.  * New File: Sept 27,1987
  7.  *
  8.  */
  9.  
  10. #include <types.h>
  11. #include <dialogs.h>
  12. #include <controls.h>
  13.  
  14. #define CDialogId 7835
  15. #define BLOCKITEM 3
  16. #define UNDERLINEITEM 4
  17. #define BLINKITEM 5
  18. #define INVISIBLE 6
  19.  
  20. #define OK 1
  21.  
  22. /* the following three variables are found in vt100.c */ 
  23.  extern Boolean useBlockCursor;
  24.  extern Boolean blink;
  25.  extern Boolean invisible;
  26.  
  27. #define __SEG__ SetCursorStyle
  28.  
  29.  void SelectCursorStyle()
  30.  {
  31.      DialogPtr theDialog;
  32.     Handle        uHandle;    /* handle to the underline item */
  33.     Handle        bHandle;    /* handle to the Block item */
  34.     Handle        aHandle;    /* handle to the OK button */
  35.     Handle        BLHandle;    /* handle to blink cursor check box */
  36.     Handle        iHandle;    /* handle to visible/invisible check box */
  37.     short        type;        /* return item type */
  38.     Rect        box;        /* returned enclosing box for item */
  39.     short        item;        /* returned by modal dialog */
  40.     GrafPtr     savePort;    /* saved graphport */
  41.     
  42.     GetPort(&savePort);        /* just in case...*/
  43.     
  44.    /* get the dialog (created invisible) */
  45.    theDialog = (DialogPtr)GetNewDialog(CDialogId,0,(Ptr)-1);
  46.    SetPort(theDialog);
  47.    
  48.    /* set the controls */
  49.    GetDItem(theDialog,BLOCKITEM,&type,&bHandle,&box);
  50.    GetDItem(theDialog,UNDERLINEITEM,&type,&uHandle,&box);
  51.    GetDItem(theDialog,BLINKITEM,&type,&BLHandle,&box);
  52.    GetDItem(theDialog,INVISIBLE,&type,&iHandle,&box);
  53.    SetCtlValue((ControlHandle)bHandle,useBlockCursor);
  54.    SetCtlValue((ControlHandle)uHandle,!useBlockCursor);
  55.    SetCtlValue((ControlHandle)BLHandle,blink);
  56.    SetCtlValue((ControlHandle)iHandle,!invisible);
  57.    
  58.    /* outline the OK button */
  59.     GetDItem(theDialog,OK,&type,&aHandle,&box);
  60.     PenSize(3,3);
  61.     InsetRect(&box,-4,-4);
  62.     FrameRoundRect(&box,16,16);
  63.     PenSize(1,1);
  64.     
  65.     /* show the window */
  66.     ShowWindow(theDialog);
  67.     
  68.     /* now we can do the dialog */
  69.     do
  70.      {  ModalDialog(0,&item);
  71.          if(item == BLOCKITEM){
  72.             useBlockCursor = true;
  73.                SetCtlValue((ControlHandle)bHandle,useBlockCursor);
  74.                SetCtlValue((ControlHandle)uHandle,!useBlockCursor);
  75.             }
  76.         if(item == UNDERLINEITEM){
  77.             useBlockCursor = false;
  78.                SetCtlValue((ControlHandle)bHandle,useBlockCursor);
  79.                SetCtlValue((ControlHandle)uHandle,!useBlockCursor);
  80.             }
  81.         if(item ==BLINKITEM){
  82.             blink = !blink ; /* invert value */
  83.             SetCtlValue((ControlHandle)BLHandle,blink);
  84.             }
  85.         if(item == INVISIBLE){
  86.             invisible = !invisible;
  87.             SetCtlValue((ControlHandle)iHandle,!invisible);
  88.             }
  89.       }
  90.      while (item != OK);
  91.      
  92.      /* cleanup and leave */
  93.      DisposDialog(theDialog);
  94.      SetPort(savePort);
  95.  }     
  96.  
  97.     
  98.